<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=no">
    <title>化粪池</title>
    <!-- Bootstrap -->
    <link href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
    <link href="{{static_url("css/mycss.css")}}" rel="stylesheet">
    <link rel="shortcut icon" href="{{static_url("images/shit_ico.png")}}">
  </head>

  <body>
    <header class="navbar navbar-default"role="navigation">
       <div class="main_container">
            
           <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" 
                 data-target="#example-navbar-collapse">
                 <span class="sr-only">切换导航</span>
                 <span class="icon-bar"></span>
                 <span class="icon-bar"></span>
                 <span class="icon-bar"></span>
              </button>
               <img src="{{static_url('images/shit.svg')}}" class="shit"></img>
              <a class="navbar-brand" href="/">化粪池</a>
           </div>
           <div class="collapse navbar-collapse" id="example-navbar-collapse">
              <ul class="nav navbar-nav">
                 <li><a href="/?query=hot">最臭</a></li>
                 <li><a href="/?query=new">最新鲜</a></li>
                 <li><a href="/publish">我有翔</a></li>
                 <li class="search">
                  <form action="/" method="POST">
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="捞翔">
                        <div id="go"><span class="glyphicon glyphicon-search" type="submit"></span></div>
                        <button type="submit" id="button">
                    </div>
                  </form>
                 </li>
              </ul>
           </div>
       </div>
    </header>
    <div id="box"></div>
    <div class="main_container">
        <span class="time info"><span class="glyphicon glyphicon-calendar"></span>{{Article[0].time}}</span>
        <div id="box"></div>
        <div><p class="article">{{Article[0].content}}</p></div>                           <!--文章内容-->
        <div class="info">
            <div>
                {% if  can_zan %}
                <div id="zan"><a href=""><img src="{{static_url('images/paper.svg')}}" class="papers"/><span id = "good" style="font-size:14px">{{Article[0].praise}}</span></a></div>  <!--点赞数-->
                {% else %}
                <div><img src="{{static_url('images/paper.svg')}}" class="papers"/><span id = "good" style="font-size:14px">{{Article[0].praise}}</span><span id="good">你已赞</span></div> <!--点赞数-->
                {% end %}
            </div>
        </div>
        
        <!--评论-->

        <div class="comments">
            <ol id="list">
              {% for com in Comments%}
                <li class="item">
                    <span class="time"><span class="glyphicon glyphicon-calendar"></span> {{com.time}}</span>   <!--评论时间-->
                    <div class="container">
                        <div class="comment_content">
                            <p>{{com.content}}</p>                                                             <!--评论内容-->
                        </div>
                    </div>
                </li>
                {% end %}
                <li class="item">
                    <form action="/comments?query={{Article[0].id}}" method="POST" id="theform">
                        <textarea id="cmt" rows="5" placeholder="我想泼翔" name="comment" maxlength="100"></textarea>
                        <span id="questions"></span><input type="text" id="ans" maxlength="3" size="3"/>
                        <button type="button" class="btn btn-default navbar-btn" id="but" onclick="disa()">泼一脸</button>
                    </form>
                </li>
            </ol>
        </div>
        
    </div>
	<div id="footer">
        <p>copyright © 2015 HuaFenChi</p>
    </div>
    <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script>
    <script src="{{static_url("js/myjs.js")}}"></script>

    <script>
        function disa() {
            var tem = document.getElementById("ans");
            var an;
            an = parseInt(tem.value);
            if (an == a + b) {
                var sub = document.getElementById("theform");
                sub.submit();
                document.getElementById("but").disabled=true;
            }
        }
        var a = Math.floor(Math.random()*100);
        var b = Math.floor(Math.random()*100);
        var ques = document.getElementById("questions");
        ques.innerHTML = a + "+" + b + "=";
    </script>
  </body>
</html>